/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: lyl  Date: 2019-03-05 Time: 14:53
 *
 * 条件查询
 */

import React, {Component} from 'react';
import {
  View,
  TouchableOpacity
} from 'react-native';
import {connect} from 'react-redux';
import AntDesign from "react-native-vector-icons/AntDesign"
import PropTypes from "prop-types";

class Search extends Component {

  static propTypes = {
    searchCode: PropTypes.string,   //查询字段Key
    dataBack:PropTypes.func,        //回调函数
    pageBack:PropTypes.string,      //返回页
    selectValue:  PropTypes.object, //已选中的值
  };

  render() {
    return (
      <TouchableOpacity activeOpacity={0.9} onPress={() => {
          let condition = this.props.searchCode.split(',');
          let dataBackFunc = this.props.dataBack;
          let pageBack = this.props.pageBack;
          let selectValue = this.props.selectValue;
          this.props.navigation.navigate('FiltersScreen',{"searchCode":condition,"dataBack":dataBackFunc,"pageBack":pageBack,"selectValue":selectValue});
      }}>
        <View style={{width: 80, height: 44, flexDirection: 'row', justifyContent: 'center', alignItems: 'center'}}>
          <AntDesign name={'search1'} size={25} style={{color:'#212121',width: 24, height: 24, marginLeft: 4}}/>
        </View>
      </TouchableOpacity>
    );
  }
}

const props = state => {
  return state
};

export default Search = connect(props)(Search)